
const express = require('express')
const verifyToken = require('./middle-ware/verifyToken');
const cors = require('cors');
const app = express()

const router = require('./router/router')
require('./utils/mongoose')
const port = 3000
const path = require('path');

app.use(express.urlencoded({ extended: false }));
app.use(express.json())

app.use(cors());

app.use('/public/uploads/avatars/', express.static(path.join(__dirname, 'public/uploads/avatars')));



app.use('/api/user/updateUserBasicInfo', verifyToken);
app.use('/api/user/getAvatar', verifyToken);
app.use('/api/user/upload-avatar', verifyToken);
app.use('/api/user/getUserAllInfo', verifyToken);
app.use('/api/task', verifyToken);
app.use('/api/user/initUserInfo', verifyToken);
app.use('/api/user/getAllUsers',verifyToken)
app.use('/api/user/deleteUserById',verifyToken)

app.use('/api',router)

app.listen(port, () => {
	console.log(`Application running on port ${port}`)
  })